<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{margin: 0;padding: 0;}
        ul{
            width: 1000px;
            overflow: hidden;
          
            margin: 20px auto;
            position: relative;
        }
        ul>li{
            width: 100px;
            height: 40px;
            list-style: none;
            float: left;
            text-align: center;
            cursor: pointer;
            line-height: 40px;
            border-bottom: 2px solid pink;
        }
        p{
            width: 100px;
            height: 40px;
            background: pink;
            border-bottom: 2px solid #000;
            position: absolute;
            bottom: 0px;
            color: #fff;
            left: 0;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <ul>
        <li>第1个选项</li>
        <li>第2个选项</li>
        <li>第3个选项</li>
        <li>第4个选项</li>
        <li>第5个选项</li>
        <li>第6个选项</li>
        <li>第7个选项</li>
        <li>第8个选项</li>
        <li>第9个选项</li>
        <li>第10个选项</li>
        <p>第1个选项</p>
    </ul>
</body>
</html>
<script src='https://code.jquery.com/jquery-3.6.0.min.js'></script>
<script>
    $('li').mouseover(function(){
        let index=$(this).index();
        // index=Number(index)+1;
        console.log(index)
        $('p').stop().animate({left:$(this).index()*100},500).text('第个'+(index+1)+'选项');
        // console.log($('p')[0])
    })
    $('ul').mouseleave(function(){
        $('p').stop().animate({left:0}).text('第个'+(index+1)+'选项')
    })
    $('p').click(function(){
        $('p').css('left',$(this).index()*100).text('第个'+(index+1)+'选项');
    })
</script>